<!DOCTYPE html>
<html lang="en">
<head>
    @@include('./_include/head.html',{
    "title":"军队侦查证换发系统",
    "filePath":".."
    })
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <!-- 顶栏导航 begin -->
    <div class="layui-header">
        <div class="layui-logo">
            <img src="../assets/images/logo.png" class="x-logo">
            <img src="../assets/images/title.png" class="x-top-title">
        </div>
        <div class="layui-layout-right">
            <ul class="x-nav-user">
                <li class="layui-nav-item">
                    <dl class="x-user-info">
                        <dd class="x-user-photo">
                            <img src="../assets/images/user.png">
                        </dd>
                        <dd class="x-user-text-box">
                            <span class="x-user-name">欢迎您，王要得</span>
                            <span class="x-user-score layui-elip">
                                <i class="user-state">状态</i>
                                军委政法委保卫局
                            </span>
                        </dd>
                       <!-- <dd class="x-user-logout">
                            <i class="iconfont icon-comment"></i>
                        </dd>
                        <dd class="x-user-logout">
                            <i class="iconfont icon-paper"></i>
                        </dd>
                        <dd class="x-user-logout">
                            <i class="iconfont icon-power"></i>
                        </dd>-->
                    </dl>
                </li>
            </ul>
        </div>
    </div>
    <!-- 顶栏导航 end -->

    <!-- 侧栏菜单 begin-->
    <div class="layui-side">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="sideNav">
                <li class="layui-nav-item x-side-nav layui-this">
                    <a lay-id="0" data-url="iframe/apply.html" href="javascript:void(0);">
                        <i class="iconfont icon-edit"></i>
                        侦查证申请
                    </a>
                </li>
                <li class="layui-nav-item x-side-nav">
                    <a lay-id="2" data-url="iframe/admin.html" href="javascript:void(0);">
                        <i class="iconfont icon-supervision"></i>
                        考试系统后台管理
                    </a>
                </li>
                <li class="layui-nav-item x-side-nav">
                    <a lay-id="3" data-url="iframe/list.html" href="javascript:void(0);">
                        <i class="iconfont icon-id-card"></i>
                        侦查证信息查看
                    </a>
                </li>
                <li class="layui-nav-item x-side-nav">
                    <a lay-id="4" data-url="iframe/list-two.html" href="javascript:void(0);">
                        <i class="iconfont icon-approval"></i>
                        申请审批
                    </a>
                </li>
            </ul>
        </div>
    </div>
    <!-- 侧栏菜单 end-->

    <!-- 主体内容 begin -->
    <div class="layui-body layui-body-panel">
        <!-- 内容主体区域 -->
        <div class="layui-tab" lay-filter="tabPage" lay-allowClose="true">
            <ul class="layui-tab-title" id="tabPage">
                <!--<li class="layui-this ban-close" lay-id="0">首页</li>-->
            </ul>
            <div class="layui-tab-content">
                <!--<div class="layui-tab-item layui-show">首页123</div>-->
            </div>
        </div>
    </div>
    <!-- 主体内容 end -->

    <!-- 底栏 begin -->
    <div class="layui-footer layui-footer-full footer-left">
        <!-- 底部固定区域 -->
        军队侦查证换发系统
    </div>
    <!-- 底栏 end -->
</div>

@@include('./_include/js.html',{
"filePath":".."
})
<script>
    (function () {
        var element = layui.element
        var currentShowTabpage = '0' // 当前显示页签

        var _fn = {
            // 点击左侧菜单执行
            selectNav: function (item) {
                var _tabTitle = item[0].innerText  // tab标题
                    , _layId = $(item[0]).attr('lay-id')  // tab lay-id  唯一
                    , _tabUrl = item[0].dataset.url || '' // tab 内嵌网页地址
                    , _currentTabList = this.getTabList() // 当选tab 标签集合
                if (!_layId) return false
                // 判断当前页签是否已经新建过
                if ($.inArray(_layId, _currentTabList) < 0) {
                    // 页签第一次打开 新建页签
                    this.addTabPage(_tabTitle, _tabUrl, _layId)
                } else if (currentShowTabpage !== _layId) {
                    // 页签 再次打开 直接选中到当前页签
                    this.switchTabPage(_layId)
                }
            },
            // 页面选项卡变化执行
            tabPageChange: function (data) {
                // 缓存当前选中tab lay-id
                currentShowTabpage = this.getTabList()[data.index]
            },
            /**
             * 页面选项卡新增
             * @param Ltitle 选项卡显示标题
             * @param url 选项内容填充iframe url
             * @param Lid 内容lay-id
             */
            addTabPage: function (Ltitle, url, Lid) {
                element.tabAdd('tabPage', {
                    title: Ltitle
                    , content: '<iframe src="' + url + '"></iframe>'
                    , id: Lid
                });
                this.switchTabPage(Lid)
            },
            /**
             *  切换页面选项卡操作
             * @param id 需要切换到页面的 lay-id
             */
            switchTabPage: function (id) {
                if (id) {
                    element.tabChange('tabPage', id);
                }
            },
            /**
             *  获取当前选项卡集合
             * @returns {Array} 选项卡页面 lay-id  集合
             */
            getTabList: function () {
                var _result = [],
                    _tabListDom = $('#tabPage').children('li')
                for (var i = 0; i < _tabListDom.length; i++) {
                    _result.push($(_tabListDom[i]).attr('lay-id'))
                }
                return _result
            },
            firstSelect: function () {
                var _currentItem = $('.layui-nav').find('.layui-this > a')
                if (_currentItem && _currentItem.length > 0) {
                    _currentItem.parents('.layui-nav-item').addClass('layui-nav-itemed')
                    setTimeout(function () {
                        _fn.selectNav(_currentItem)
                    }, 0)

                }
            }
        }

        // 左侧菜单选择监控
        element.on('nav(sideNav)', function (item) {
            _fn.selectNav(item)
        })
        // tabPage 切换监控
        element.on('tab(tabPage)', function (data) {
            _fn.tabPageChange(data)
        })

        _fn.firstSelect()
    })();
</script>
</body>
</html>